<#include '/admin/sonheader.html' >
<style>
	.layui-input-line{float: left;width:300px}
	.layui-form-pane .layui-form-label{width: 180px;float: left;}
	.layui-select-title input{
  width:100%;
 }
 .layui-unselect {
  width:50%;
 }
 .layui-input{
  width: 75%;
 }
</style>
<div class="admin-main">
	<div style="padding: 10px 0 10px 60px">
		<form id="regionForm"  class="layui-form layui-form-pane">					
				<div class="layui-form-item">
		    		<label class="layui-form-label" >地区名称</label>
		    		<div class="layui-input-line">
		      			<input type="text"  name="local_name"  maxlength="60" id="local_name" lay-verify="required" class="layui-input">
		    		</div>
  				</div>
  				<div class="layui-form-item">
		    		<label class="layui-form-label">邮政编码:</label>
		    		<div class="layui-input-line" >
		      			<input type="text"  name="zipcode"  maxlength="6" id="local_name"  lay-verify="required|number" class="layui-input">
		    		</div>
  				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" >是否支持货到付款:</label>
		    		<div class="layui-input-line">
		      			<select name="cod" id="cod">
								<option value="1">支持</option>
					     		<option value="0" >不支持</option>
						</select>
		   			</div>
		  		</div>				
			<input type="hidden" name="p_region_id" value="0">
			<input type="hidden" name="region_grade" value="1">
			<div class=" layui-layer-btn layui-layer-btn-" style="padding:8px 12px;z-index:1000;position: fixed;left: 0px;bottom: 0px;background: rgba(230,230,230,0.8) ;height: 40px;width: 97%;"> 
		  		<a class="layui-layer-btn0"  type="submit"  lay-submit=""  lay-filter="save">保存</a> 					
		  		<a class="layui-layer-btn1">取消</a>
		  	</div>
		</form>
	</div>
</div>
<script type="text/javascript">
var index = parent.layer.getFrameIndex(window.name);

layui.use(['form', 'layedit', 'laydate'], function(){
    var form = layui.form()
        ,layer = layui.layer
        ,layedit = layui.layedit
        ,laydate = layui.laydate;
    
    
    $(".layui-layer-btn1").click(function(){
    	parent.layer.close(index);
    });
    
    form.on('submit(save)', function(){ 
    	var options = {
   			url:"${ctx}/shop/admin/region/save-add.do?ajax=yes",
   			type:"post",
   			dataType:"json",
   			success:function(data){
   				if(data.result==1){	
   					parent.$.Loading.success(data.message);
   					parent.layer.close(index); //再执行关闭        
   					parent._goodsCatEdit.refreshData();
   				}else{
   					parent.$.Loading.error(data.message);
   				}
   			}
   		};
   		$("#regionForm").ajaxSubmit(options);
       return false; 
    });
}); 
</script>
